package com.tjsinfo.tjsoa.system.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.system.bo.ISystemAllGroupBO;
import com.tjsinfo.tjsoa.system.bo.ISystemPrivateGroupBO;
import com.tjsinfo.tjsoa.system.vo.TSystemAllgroup;
import com.tjsinfo.tjsoa.system.vo.TSystemPrivategroup;
import com.tjsinfo.tjsoa.system.vo.TSystemUserallgroup;
import com.tjsinfo.tjsoa.system.vo.TSystemUserprivategroup;

public class UpdatePrivateGroupFormAction extends Action {
	private ISystemPrivateGroupBO systemPrivateGroupBO;
	
	
	


	public ISystemPrivateGroupBO getSystemPrivateGroupBO() {
		return systemPrivateGroupBO;
	}





	public void setSystemPrivateGroupBO(ISystemPrivateGroupBO systemPrivateGroupBO) {
		this.systemPrivateGroupBO = systemPrivateGroupBO;
	}





	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		Integer id = Integer.parseInt(request.getParameter("id"));
		TSystemPrivategroup systemAllgroup = systemPrivateGroupBO.selectTSystemPrivategroupById(id);
		List<TSystemUserprivategroup> systemUserallgroupList = systemPrivateGroupBO.selectTSystemUserPrivategroupById(id);
		String userid = "" ;
		String username = "" ;
		for (TSystemUserprivategroup systemUserallgroup : systemUserallgroupList) {
			userid += systemUserallgroup.getSystemUser().getUserId() + ",";
			username += systemUserallgroup.getSystemUser().getUserName() + ",";
		}
		systemAllgroup.setSystemUserAllGruopId(userid);
		systemAllgroup.setSystemUserAllGruopName(username);
		request.setAttribute("systemAllgroup", systemAllgroup);
		return mapping.findForward("success");
		
	}
}

